<p class="Paragraph">On this tab page define the form properties referring to the database that is linked to the form.</p>
</help:to-be-embedded>
<p class="Paragraph">Define here the data source on which the form should be based or if the data from thze form's user can be manipulated. Apart from the sort and filter functions, you will also find all the necessary properties to create a <help:link Id="65955" Eid="unterformular" xmlns:help="http://openoffice.org/2000/help">subform</help:link></p>
<p class="Paragraph">If the form is based on an SQL statement (see <span class="T1">Data Source</span> property) the filter and sort functions are available only if the SQL statement refers to a table and is not written in the database's native SQL.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Define the database containing the data source to which the form should refer.</help:help-text> If you click the<span class="T1"> ...</span> button, you call the dialog <help:link Id="65703" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Open</span></help:link>, where you can choose the desired data base.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Determine the data source to be used for the form. The data source can <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>be an existing table or a query (previously created in the database) or, it can be defined by an SQL-statement. Before you enter a data source you have to define the exact type in <span class="T1">Type of data source</span>.</help:help-text></p>
<p class="Paragraph">Forms that have been assigned to a database, that is to say that have been created in the form container of the database by using the command <span class="T1">New - Form</span>, will always belong to that database. The data source used for these forms cannot be changed at a later point in time. This is only possible (and necessary) if you use the floating toolbar <span class="T1">Form Functions</span> to convert a "normal" document into a form.</p>
<p class="Paragraph">If you have selected either the option "Table" or "Query" under <span class="T1">Type of Data Source</span>, the combo box lists all the exists data sources of this type, i.e. all tables and queries set up in the selected database. If you want the form to refer to a query, you first have to select the option "Query" as data source type, so that you can specify a query as the data source.</p>
<p class="Paragraph">You can also enter an SQL statement in the <span class="T1">Data Source</span> box, if you have selected the "SQL" option as the data source type. This statement is used to create an SQL query, which is used as a basis for generating the form or for defining a <help:link Id="65955" Eid="unterformular" xmlns:help="http://openoffice.org/2000/help">subform</help:link>.</p>
<p class="Head2"><help:help-id value="HID_PROP_CURSORSOURCETYPE" xmlns:help="http://openoffice.org/2000/help"/>Type of data source</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Define whether the data source is to be an existing database table or query or if the form is to be generated based on an SQL statement.</help:help-text></p>
<p class="Paragraph">If you choose "Table" or "Query", the form will refer to the existing table or query that you specify under <span class="T1">Data Source</span>. If you want to create a new query or a <help:link Id="65955" Eid="unterformular" xmlns:help="http://openoffice.org/2000/help">subform</help:link>, then you have to choose the "SQL" option. You can then enter the statement for the SQL query or the subform directly in the <span class="T1">Data Source</span> box. The form is then generated on the basis of the specified statement.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">If you choose SQL statement under Data Source, decide if the SQL statement is to be analyzed (yes) or not (no) here.</help:help-text></p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Enter the required conditions for filtering the data in the form. The filter specifications follow SQL-rules without using the WHERE clause.</help:help-text> For example, if you want to display all records with the "Mike" forename, simply enter in the data field Forename = 'Mike'. You can also combine conditions: Forename = Mike OR Forename = Peter, all records with these two conditions will be displayed.</p>
<p class="Paragraph">The filter function is available in user mode through the <help:link Id="65981" xmlns:help="http://openoffice.org/2000/help"><span class="T1">AutoFilter</span></help:link> and <help:link Id="65999" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Standard Filter</span></help:link> icons on the <help:link Id="65578" xmlns:help="http://openoffice.org/2000/help">form bar</help:link>.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">You can enter the desired conditions to sort the data in the form. The specification of the sorting conditions follows SQL rules without the use of the ORDER BY clause.</help:help-text> For example, if you want all registers of a data base to be sorted on one field in an ascending order and on other field in a descending order, enter (Name of field 1) ASC, (Name of field 2) DESC.</p>
<p class="Paragraph">The appropriate icons on the <help:link Id="65578" xmlns:help="http://openoffice.org/2000/help">Forms bar</help:link> can be used in User mode to sort: <help:link Id="65990" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Sort Ascending</span></help:link>, <help:link Id="65969" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Sort Descending</span></help:link>, <help:link Id="66041" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Sort</span></help:link>.</p>
<p class="Head2"><help:help-id value="HID_PROP_DATAENTRY" xmlns:help="http://openoffice.org/2000/help"/>Add data only</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Determine here if the form should only permit the addition of new data (Yes) or if it should permit other properties (No).</help:help-text></p>
<p class="Paragraph">Notice that changing or deleting previously added data is not possible. You can only add data since you can not view the already existing records.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Decide if the navigation functions in the form bar can be used in the lower margin of the form (Yes) or not (No).</help:help-text></p>
<p class="Paragraph">The "Parent Form" option is used for subforms. If you choose this option for a subform you can navigate using the records of the main form if the cursor is placed in the subform. Because a subform is linked to the main form by a 1:1 relationship, navigating within the subform does not make any sense. The navigation is always completed in the parent form.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help"> Determine here if the navigation should be done using the tab key.</help:help-text> Using the tab key you can move forward in the form. If you simultaneously press the Shift key, the Navigation will follow the opposite direction. If you reach the last (or the first) field and press again the the tab key, it can have various effects. Define the key control with the following options:</p>
<p class="TextInTable">This setting automatically defines a cycle which follows an existing database link: If the form contains a database link, the Tab key will, by default, initiate a change to the next or previous record on exit from the last field (see All Records). If there is no database link the next/previous form is shown (see Current Page).</p>
<p class="TextInTable">This option applies to database forms only and is used to navigate through all records. The current record is changed on exit from the last field of a form via the Tab key.</p>
<p class="TextInTable">Similarly, this option applies to database forms only and is used to navigate within the current record. The current record is kept on exit from the last field of a form via the Tab key.</p>
<p class="TextInTable">On exit from the last field of a form the cursor skips to the first field in the next form. This is standard for HTML forms; therefore, this option is especially relevant for HTML forms.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Determine if data can be added (Yes) or not (No).</help:help-text></p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help"> Determine here if the data can be modified (Yes) or not (No).</help:help-text></p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">Determine here if the data can be deleted (Yes) or not (No).</help:help-text></p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">If you create a <help:link Id="65955" Eid="unterformular">subform</help:link>, enter here the data field of the parent form responsible of the synchronization between parent and subform.</help:help-text> If you would like to enter various values, press <help:switch select="System" xmlns:help="http://openoffice.org/2000/help"><help:case select="MAC">Command</help:case><help:default>Ctrl</help:default></help:switch> + Enter key after each input line.</p>
<p class="Paragraph">The subform is based on a <help:popup Id="65619" Eid="sql" xmlns:help="http://openoffice.org/2000/help">SQL</help:popup> query; more specifically, on a <help:link Id="66162" Eid="parameterabfrage" xmlns:help="http://openoffice.org/2000/help">Parameter Query</help:link>. If a field name is entered in the <span class="T1">Link master fields</span> field, the data contained in that field in the main form are read to a variable that you must enter in <span class="T1">Link slave fields</span>. In an appropriate SQL statement, this variable is compared to the table data the subform refers to. This procedure determines the type of display in the subform.</p>
<p class="Paragraph">Consider the following example:</p>
<p class="Paragraph">The database table on which the form is based is, for example, a customer database ("Customer"), where every customer has been given a unique number in a data field named "Cust_ID". A customer's orders are maintained in another database table. You now want to see each customer's orders after entering them into the form. In order to do this you should create a subform and under <span class="T1">Link master fields</span> enter the data field from the customer database which clearly identifies the customer, i.e. "Cust_ID" (without quotes). Under <span class="T1">Link slave fields</span> enter the name of a variable which is to accept the data of the field Cust_ID, e.g. "x".</p>
<p class="Paragraph">The subform should show the appropriate data from the orders table ("Orders") for each customer or customer ID (Customer_ID -> x). Of course this is only possible if each order is uniquely assigned to one customer in the orders table. Alternatively, you can use a field called "Cust_ID"; to make sure that this field is not confused with the field from the main form (which we will assume is called "Customer_ID").</p>
<p class="Paragraph">Now you simply compare the "Cust_ID" in the "Orders" table with the "Customer_ID" from the "Customers" table, which can be done using the x variable, e.g. with the following SQL statement:</p>
<p class="Paragraph">SELECT * FROM Order WHERE Cust_ID =: x (if you want the subform to show all data from the orders table)</p>
<p class="Paragraph">or:</p>
<p class="Paragraph">SELECT Item FROM Orders WHERE Cust_ID =: x (if you want the subform from the orders table to show only the data contained in the "Item" field)</p>
<p class="Paragraph">The SQL statement can either be entered in the <span class="T1">Data Source</span> field, or you can create an appropriate parameter query, which can be used to create the subform.</p>
<p class="Paragraph"><help:help-text value="visible" xmlns:help="http://openoffice.org/2000/help">If you create a subform, enter here the variable where possible values from the parent form field can be stored.</help:help-text> If a subform is based on an existing query, enter here the variable that you defined in the query. If you create a form using an SQL statement, entered in the <span class="T1">Data source</span> field, enter the variable you use in the statement. You can freely choose the variable name. If you want to enter various values, press <help:switch select="System" xmlns:help="http://openoffice.org/2000/help"><help:case select="MAC">Command</help:case><help:default>Ctrl</help:default></help:switch> + Enter.</p>
<p class="Paragraph">If, for example, you specified the "CustomerID" database field as a parent field under <span class="T1">Link master fields</span>, then you can define under <span class="T1">Link slave fields</span> the name of the variable in which the values of the "CustomerID" database field are to be read. If you now specify an SQL statement in the <span class="T1">Data Source</span> box using this variable, the relevant values are displayed in the subform.</p>
<p class="Head2"><a name="unterformular"/>What is a subform?</p>
<p class="Paragraph">Forms are created based on a database table or database query. They display the data in a graphical fashion and can be used to enter new data or change existing data which is then stored in the database table or query used as the basis of the form.</p>
<p class="Paragraph"><help:to-be-embedded Eid="wozu" xmlns:help="http://openoffice.org/2000/help">Should you require a form, which not simply refers to the data in a table or query but which is also to display data in another table, then you can create a subform in your form.</help:to-be-embedded> This subform may comprise a text box, for example, which records the data of a second database table.</p>
<p class="Paragraph">A subform is nothing more than an "additional component of the main form". The "main form" is termed the "superior form". When created, it is based on a database table containing the more important form data, all the other data administered in a database table is used to form an additional component: the subform. Subform are also needed as soon as you want to access more than one table from a form. Each table requires its own subform.</p>
<p class="Paragraph">A subform is seen as such by the user. The user only sees a form in which data is entered or where existing data is displayed. Using this form and subforms, it is possible to generate a simple customized input mask for the user, irrespective of how the data is managed in the database.</p>